<?php

namespace App\Admin\Controllers;

use App\Models\LotterySetting;
use Dcat\Admin\Form;
use Dcat\Admin\Grid;
use Dcat\Admin\Show;
use Dcat\Admin\Http\Controllers\AdminController;

class LotterySettingController extends AdminController
{
    /**
     * Make a grid builder.
     *
     * @return Grid
     */
    protected function grid()
    {
        return Grid::make(new LotterySetting(), function (Grid $grid) {
            $grid->column('id')->sortable();
            $grid->column('amount');
            $grid->column('weight');

            $grid->disableDeleteButton();
            $grid->disableViewButton();
            $grid->disableCreateButton();
            $grid->disableBatchActions();
            $grid->disableRowSelector();
        });
    }

    /**
     * Make a show builder.
     *
     * @param mixed $id
     *
     * @return Show
     */
    protected function detail($id)
    {
        return Show::make($id, new LotterySetting(), function (Show $show) {
            $show->field('id');
            $show->field('amount');
            $show->field('weight');
        });
    }

    /**
     * Make a form builder.
     *
     * @return Form
     */
    protected function form()
    {
        return Form::make(new LotterySetting(), function (Form $form) {
            $form->display('id');
            $form->text('amount');
            $form->text('weight');
            $form->disableDeleteButton();
            $form->disableViewButton();
            $form->disableViewCheck();
            $form->disableEditingCheck();
            $form->disableResetButton();
        });
    }
}
